Skip to content

feat(skills): source dd-apm sub-skills via agent-skills Cargo git dep (alternative to #530)#536

Open
platinummonkey wants to merge 10 commits into
mainfrom
claude/pr-530-submodules-alternatives-l6iVf
Open

feat(skills): source dd-apm sub-skills via agent-skills Cargo git dep (alternative to #530)#536
platinummonkey wants to merge 10 commits into
mainfrom
claude/pr-530-submodules-alternatives-l6iVf

Conversation

@platinummonkey

Copy link
Copy Markdown
Collaborator

What this does

Alternative to #530 that avoids git submodules entirely.

Instead of a .gitmodules entry and submodules: recursive on every CI checkout step, this PR treats datadog-labs/agent-skills as a Cargo git dependency — the same pattern already used for datadog-api-client:

agent-skills = {
  git = "https://github.com/datadog-labs/agent-skills",
  rev = "c447f4d42f05fa8497c6fa0d1ee3889b7020dce3"
}

src/skills.rs consumes two constants from the crate:

  • agent_skills::DD_APM_SKILL — the router SKILL.md
  • agent_skills::DD_APM_SUB_SKILLS — the 11 nested sub-skill paths + content

pup skills install dd-apm writes 12 files (root + 11 sub-skills) exactly as in #530, with no change to developer workflow or CI.

Why not submodules

  • git clone without --recurse-submodules silently produces a broken build
  • Required patching 14 checkout steps across 3 workflow files; any new job would silently break without submodules: recursive
  • Updates require git submodule update --remote + rebuild rather than a single rev bump in Cargo.toml
  • No Cargo-native tracking — drifts from Cargo.lock

Changes in this PR (pup side only)

File Change
Cargo.toml Add agent-skills git dep, pinned to rev
src/skills.rs dd-apm entry uses crate constants; install_paths extended to write nested sub-skill files; files field doc updated
src/skills.rs (tests) Two new tests: sub-skills written at correct paths, sub-skills skipped for AgentMd format

No .gitmodules. No CI changes.

Prerequisite: companion PR to agent-skills

This PR is a draft and will not build until datadog-labs/agent-skills ships a Cargo.toml + src/lib.rs exposing:

pub const DD_APM_SKILL: &str = include_str!("../skills/dd-apm/SKILL.md");

pub static DD_APM_SUB_SKILLS: &[(&str, &str)] = &[
    ("service-remapping/SKILL.md", include_str!("../skills/dd-apm/service-remapping/SKILL.md")),
    ("k8s-ssi/agent-install/SKILL.md",      include_str!("../skills/dd-apm/k8s-ssi/agent-install/SKILL.md")),
    ("k8s-ssi/enable-ssi/SKILL.md",         include_str!("../skills/dd-apm/k8s-ssi/enable-ssi/SKILL.md")),
    ("k8s-ssi/verify-ssi/SKILL.md",         include_str!("../skills/dd-apm/k8s-ssi/verify-ssi/SKILL.md")),
    ("k8s-ssi/troubleshoot-ssi/SKILL.md",   include_str!("../skills/dd-apm/k8s-ssi/troubleshoot-ssi/SKILL.md")),
    ("k8s-ssi/onboarding-summary/SKILL.md", include_str!("../skills/dd-apm/k8s-ssi/onboarding-summary/SKILL.md")),
    ("linux-ssi/agent-install/SKILL.md",      include_str!("../skills/dd-apm/linux-ssi/agent-install/SKILL.md")),
    ("linux-ssi/enable-ssi/SKILL.md",         include_str!("../skills/dd-apm/linux-ssi/enable-ssi/SKILL.md")),
    ("linux-ssi/verify-ssi/SKILL.md",         include_str!("../skills/dd-apm/linux-ssi/verify-ssi/SKILL.md")),
    ("linux-ssi/troubleshoot-ssi/SKILL.md",   include_str!("../skills/dd-apm/linux-ssi/troubleshoot-ssi/SKILL.md")),
    ("linux-ssi/onboarding-summary/SKILL.md", include_str!("../skills/dd-apm/linux-ssi/onboarding-summary/SKILL.md")),
];

Once that lands, update the rev here to point at the new commit and mark this PR ready for review.

Updating sub-skills going forward

# Bump this rev in Cargo.toml — one line, one reviewer, full audit trail
agent-skills = { git = "https://github.com/datadog-labs/agent-skills", rev = "<new-rev>" }

Then cargo update -p agent-skills to refresh Cargo.lock. No submodule commands, no CI changes.


Generated by Claude Code

@datadog-official

This comment has been minimized.

ryanmaclean pushed a commit to datadog-labs/agent-skills that referenced this pull request Jun 8, 2026
Adds compile-time constants for every SKILL.md in the repo so downstream
crates (e.g. pup) can depend on this as a Cargo git dep and access skill
content without git submodules.

Pattern matches the expected interface in DataDog/pup#536:
- DD_<PRODUCT>_SKILL (&str) for products with a root SKILL.md
- DD_<PRODUCT>_SUB_SKILLS (&[(&str, &str)]) for products with sub-skills,
  where each tuple is (relative_path, content)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
claude and others added 6 commits June 8, 2026 11:38
Replace the submodule approach proposed in #530 with a Cargo path
dependency. No .gitmodules, no `submodules: recursive` peppered across
every CI checkout step.

- crates/agent-skills/: new crate vendoring the 12 dd-apm SKILL.md
  files from datadog-labs/agent-skills@c447f4d (root router + 11 nested
  sub-skills under k8s-ssi/, linux-ssi/, service-remapping/)
- Cargo.toml: add `agent-skills = { path = "crates/agent-skills" }`; a
  comment shows how to flip to a git dep once agent-skills ships a
  Cargo.toml, with no other pup changes needed
- src/skills.rs: use agent_skills::DD_APM_SKILL / DD_APM_SUB_SKILLS
  instead of bare include_str!(); extend install_paths to write nested
  sub-skill files alongside the root SKILL.md (SkillMd format only);
  update files field doc; add two new tests for sub-skill install paths

https://claude.ai/code/session_01BfYL9qPvktFuLXHNyH3rPB
The previous commit vendored the agent-skills content into a local
crates/ directory, which is equivalent to Option 1 (direct copy).
This commit corrects that: remove crates/agent-skills/ entirely and
point Cargo.toml at the upstream repo directly.

Cargo.toml now uses a git dep pinned to the same commit referenced by
PR #530, matching the pattern already used for datadog-api-client:

  agent-skills = {
    git = "https://github.com/datadog-labs/agent-skills",
    rev = "c447f4d42f05fa8497c6fa0d1ee3889b7020dce3"
  }

The SKILL.md files stay in the agent-skills repo only. Updating means
bumping the rev in Cargo.toml — a single, reviewable line change.

This PR requires a companion change to datadog-labs/agent-skills to
add a Cargo.toml and src/lib.rs that expose DD_APM_SKILL and
DD_APM_SUB_SKILLS as compile-time constants (the same API consumed in
src/skills.rs).

https://claude.ai/code/session_01BfYL9qPvktFuLXHNyH3rPB
Updates the agent-skills git dep from c447f4d to 05c76987,
the commit that initializes the repo as a proper Cargo library.
Cargo.lock updated via cargo fetch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The shallow two-level counter was written when dd-apm had a single
SKILL.md. Now that dd-apm ships 12 files (root + 11 sub-skills), use
a recursive file counter and assert 15 (12 dd-apm + 3 dd-pup-pi).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@platinummonkey platinummonkey force-pushed the claude/pr-530-submodules-alternatives-l6iVf branch from 90582eb to fc35bf7 Compare June 8, 2026 16:40
platinummonkey and others added 4 commits June 8, 2026 11:44
- Use unwrap_or_else with path context so panics name the failing dir
- Add spot-check for dd-apm/k8s-ssi/agent-install/SKILL.md to verify
  nested sub-skill paths are preserved (count alone can't catch flattening)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Exact counts are a moving target as agent-skills adds sub-skills.
The specific path assertions already verify correctness; the count
check just guards against a silent zero-file install.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace >= 1 with a floor derived from agent_skills::DD_APM_SUB_SKILLS.len()
so the bound grows automatically as sub-skills are added without re-pinning
a magic number. Also add README.md and linux-ssi path existence checks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@platinummonkey platinummonkey marked this pull request as ready for review June 8, 2026 17:42
@platinummonkey platinummonkey requested a review from a team as a code owner June 8, 2026 17:42
@dd-octo-sts-94e5d1

Copy link
Copy Markdown

🐑 PR Shepherd is maintaining this PR

I watch your PR and automatically fix CI failures, rebase your branch, handle flaky tests, and push it to the merge queue when it's ready.

More about what I do → Guide

To pause me on this PR, add the flow-skip label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants